package net.biancheng.c.controller;

import net.biancheng.c.entity.Dept;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController
public class DeptWrapController {
    public final RestTemplate restTemplate;

    @Autowired
    public DeptWrapController(RestTemplate restTemplate) {
        this.restTemplate = restTemplate;
    }

    @RequestMapping("/dept/get/{id}")
    public Dept deptGet(@PathVariable("id") Integer id) {
        String target_url = "http://MICROSERVICECLOUDPROVIDERDEPT/dept/get/" + id;
        return restTemplate.getForObject(target_url, Dept.class);
    }
}
